<style>
.source_name{width:20%;}
td.source_name{text-align:left;}
</style>
<div class="row">
<!-- 表示一个成功的或积极的动作 -->
<a href="{:U('Ad/index')}"><button type="button" class="btn btn-primary">广告位</button></a>
<a href="{:U('Ad/adlist')}"><button type="button" class="btn btn-primary">所有广告</button></a>
<a href="{:U('Ad/mobile_ad')}"><button type="button" class="btn btn-primary active">手机广告</button></a>
</div>
<table class="table table-hover table-responsive">
   <thead>
      <tr>
         <th class="source_name">名称</th>
         <th>位置</th>
         <th>操作</th>
      </tr>
   </thead>
   <tbody>
   <volist name="data" id="data">
      <tr id="tr_{$data.id}">
         <td class="source_name">{$data.name}</td>
         <td>{$data.position}{$data.code}</td>
         <td>
			<a href="javascript:void(0);" data-id="{$data.id}" class="del_btn">删除</a>
		</td>
      </tr>
    </volist>
   </tbody>
</table>

</div>
<script>
$(function(){
	
	$(".del_btn").click(function(){
		if(confirm('您确定要删除该广告吗？删除之后将不能再恢复')){
			var id=$(this).attr('data-id');
			$.get("{:U('Ad/del_mobile')}",{id:id},function(data){
				if(data==1){
					$("#tr_"+id).remove();
				}else{
					alert('很遗憾，广告删除失败，请重试！');
				}
			});
		}
	});
	
	
});

</script>







